﻿using LBSoft.Common.DotNetCode;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace LBSoft.HplusAdmin
{
    public partial class VerificationCode : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            ValidatedCode v = new ValidatedCode();
            string code = v.CreateVerifyCode();            //取随机码
            Session["VerifyCode"] = code;                   //Session 取出验证码
            SetPageNoCache();
            v.CreateImageOnPage(code, this.Context);       // 输出图片
        }

        /// <summary>
        /// 设置页面不被缓存
        /// </summary>
        private void SetPageNoCache()
        {
            Response.Buffer = true;
            Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1);
            Response.Expires = 0;
            Response.CacheControl = "no-cache";
            Response.AppendHeader("Pragma", "No-Cache");
        }
    }
}